package com.biglead.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biglead.demo.mapper.GoodsMapper;
import com.biglead.demo.pojo.Goods;
import com.biglead.demo.service.GoodsService;
import com.biglead.demo.vo.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;
    @Override
    public List<GoodsVo> findGoodsVo() {
        return goodsMapper.findGoodsVo();
    }

    @Override
    public int updateGoodsStock(Goods goods) {
        return goodsMapper.updateGoodsStock(goods);
    }

    @Override
    public List<Goods> findAllGoods() {
        return goodsMapper.selectList(new QueryWrapper<Goods>());
    }

    @Override
    public Goods findGoods(Long goodsId) {
        return goodsMapper.selectById(goodsId);
    }

    @Override
    public GoodsVo findGoodsVoByGoodsId(Long goodsId) {
        return goodsMapper.findGoodsVoByGoodsId(goodsId);
    }
}
